{% load i18n %}
{% load promgen %}
<div class="well">
  {% if service.description %}
  <div class="panel panel-default">
    <div v-pre class="panel-body">
      {{service.description|linebreaksbr|urlize}}
    </div>
  </div>
  {% endif %}

  <div data-service="{{service.name}}" class="panel panel-danger" v-cloak v-if="activeServiceAlerts.has('{{service.name}}')">
    <div class="panel-heading">
      <a @click="toggleComponent('alerts-service-{{service.name|slugify}}')" class="btn btn-danger btn-sm" role="button">Alerts</a>
    </div>
    <table v-if="components['alerts-service-{{service.name|slugify}}']" class="table table-bordered table-condensed">
      <tr v-for="alert in activeServiceAlerts.get('{{service.name}}')">
        {% include 'promgen/alert_row.html' %}
      </tr>
    </table>
  </div>

  <a
    v-cloak
    v-if="getActiveSilencesForService('{{service.name}}').length > 0"
    @click="openSilenceListModal(null, silences=getActiveSilencesForService('{{service.name}}'), 'service')"
    class="btn btn-warning btn-sm mb-4"
    role="button"
  >
    Active silences
  </a>

  <div class="panel panel-default">
    <div class="panel-body">
      <div class="btn-group btn-group-sm mr-2" role="group" aria-label="...">
        <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
          {% trans "Register" %} <span class="caret"></span>
        </button>
        <ul class="dropdown-menu">
          <li role="presentation"><a href="{% url 'project-new' service.id %}">{% trans "Register Project" %}</a></li>
          <li role="presentation"><a href="{% url 'rule-new' 'service' service.id %}">{% trans "Register Rule" %}</a></li>
          <li role="presentation"><a href="{% url 'service-notifier' service.id %}">{% trans "Register Notifier" %}</a></li>
        </ul>
      </div>

      {% include "promgen/service_action_button_group.html" %}

    </div>
  </div>

  {% include "promgen/service_block_panel_rules.inc.html" %} 

  {% include "promgen/service_block_panel_notifiers.inc.html" %}

  {% include "promgen/service_block_projects.html" with project_list=project_list|default:service.project_set.all service=service only %}

</div><!-- end well-->
